<?php
//
//	file: includes/aucp/color_plug_posts.php
//	begin: 30/04/2007
//	$Author: christopher $
//	$Revision: 29 $
//	$Date: 2008-07-19 15:59:35 +0000 (Sat, 19 Jul 2008) $
//	license: http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
//
//	description: color plugs for class_posts

if (!defined('IN_PHPBB'))
{
	die("Hacking attempt");
}

class color_posts extends plug_ins
{
	function set_posts(&$posts)
	{
		$this->posts = &$posts;

		return;
	}

	function display($post_id=0, $tpl_switch='')
	{
		global $colors, $user, $template;

		if(!$post_id)
		{
			return;
		}

		// first, we get data for the specific row
		$postrow = $this->posts->data[intval($post_id)];
		$poster_id = isset($user->pool[ $postrow['poster_id'] ]) ? $postrow['poster_id'] : ANONYMOUS;

		// then, we play with the poster block for that user
		$tpl_data = array(
			'POSTER_NAME' => ($poster_id == ANONYMOUS) ? $colors->get_user_color(GROUP_ANONYMOUS, 0, $user->lang('Guest')) : $colors->get_user_color($user->pool[$poster_id]['user_group_id'], $user->pool[$poster_id]['user_session_time'], $user->pool[$poster_id]['username']),
		);

		if ( empty($tpl_switch) )
		{
			$template->assign_vars($tpl_data);
		}
		else
		{
			$template->assign_lastblock_vars($tpl_switch, $tpl_data);
		}

		return;
	}
}

?>